﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RegExStudio.UserControls
{
    /// <summary>
    /// Basis für alle UserControls im RegExStudio
    /// Beinhaltet des Highlighting des Eingabecontrols das den Fokus hat
    /// </summary>
    public partial class CtrlBase : UserControl
    {
        /// <summary>
        /// ctor
        /// </summary>
        public CtrlBase()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Control wird geladen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CtrlBase_Load(object sender, EventArgs e)
        {
        }

        /// <summary>
        /// Den Hintergrund im aktivem Control färben
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Control_Enter(object sender, EventArgs e)
        {
            Control ctrl = sender as Control;
            ctrl.BackColor = Properties.Settings.Default.ActiveControlBackground;
        }

        /// <summary>
        /// Den Hintergrund im gerade verlassenem Control zurücksetzen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Control_Leave(object sender, EventArgs e)
        {
            Control ctrl = sender as Control;
            ctrl.BackColor = System.Drawing.Color.Empty;
        }
    }
}
